package com.wzcl.app.model.vo;

import com.wzcl.app.dao.model.ActivityRuleInfo;
import com.wzcl.app.model.common.WZCL;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.beans.BeanUtils;

import java.util.Map;

@EqualsAndHashCode(callSuper = false)
@Data
public class ActivityRuleInfoVo extends BaseVo{
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(name = "属性")
    private Integer property;
    private String propertyStr;

    @ApiModelProperty(name = "比较")
    private Integer compare;
    private String compareStr;

    @ApiModelProperty(name = "比较值")
    private Integer value;

    private ActivityRuleInfoVo() {
    }

    public static ActivityRuleInfoVo create(ActivityRuleInfo ruleInfo){
        ActivityRuleInfoVo activityRuleInfoVo = new ActivityRuleInfoVo();
        BeanUtils.copyProperties(ruleInfo,activityRuleInfoVo);
        activityRuleInfoVo.translationValueStr();
        return activityRuleInfoVo;
    }

    @Override
    public void translationValueStr() {
        Map<String, Map<Integer, String>> map = getTranslationMap();
        this.propertyStr = map.get(WZCL.GROUP_NAME.ACTIVITY_RULE_INFO_PROPERTY).get(this.property);
        this.compareStr = map.get(WZCL.GROUP_NAME.ACTIVITY_RULE_INFO_COMPARE).get(this.compare);
    }

    @Override
    public void processResources() {

    }
}
